package com.itheima.stream流.多种获取方法;

import java.util.ArrayList;
import java.util.Collections;
import java.util.stream.Stream;

public class Test3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "林青霞", "张曼玉", "王祖贤", "柳岩", "张敏", "张无忌", "张三丰", "张翠山");
        System.out.println("---只要前六个---");
        Stream<String>limitStream=list.stream().limit(6);


     //   list.stream().limit(6).forEach(s-> System.out.println(s));
        System.out.println("---去掉前六个---");
        Stream<String>skipStream=list.stream().skip(list.size()-3);


     //   list.stream().skip(5).forEach(s-> System.out.println(s));
        System.out.println("---合并limitStream和skipStream---");
        Stream<String>concatStream=Stream.concat(limitStream,skipStream);

        concatStream.forEach(s-> System.out.println(s));

    }
}
